import { _ as _export_sfc, c as createBlock, o as openBlock, w as withCtx, b as createVNode, i as index$g, n as normalizeStyle, f as normalizeClass, r as renderSlot, e as createCommentVNode, t as createTextVNode, u as toDisplayString, g as createElementBlock, F as Fragment, h as renderList, Q as index$x, M as withModifiers } from './index-Cc4oxzDN.js';

//const props = defineProps(['show','custom','width','padding','radius','title','content','color','size','shape','button','maskClosable','fadein'])

const _sfc_main = {
  __name: 'modal',
  props: {
	 show: {type: Boolean,default: false},
	 custom: {type: Boolean,default: false},
	 width: {type: String,default: "84%"},
	 padding: {type: String,default: "40rpx"},
	 radius: {type: String,default: "24rpx"},
	 title: {type: String,default: ""},
	 content: {type: String,default: ""},
	 color: {type: String,default: "#999"},
	 size: {type: Number,default: 28},
	 shape: {type: String,default: 'square'}, //形状 circle, square
	 button: {type: Array,
				default: function() {
					return [{
						text: "取消",
						type: "red",
						plain: true //是否空心
					}, {
						text: "确定",
						type: "red",
						plain: false
					}]
			}},
	maskClosable: {type: Boolean,default: true},
	custom: {type: Boolean,default: false},
	fadein: {type: Boolean,default: false} //淡入效果，自定义弹框插入input输入框时传true
},
  emits: ['click','cancel','test'],
  setup(__props, { emit: __emit }) {

const props = __props;

// const show = ref(props.show)
// const maskClosable = ref(props.maskClosable)
const emit = __emit;
const handleClick = (e) => {
	if (!props.show) return;
	const dataset = e.currentTarget.dataset;
	emit('click', {
		index: Number(dataset.index)
	});
};
const handleClickCancel = () => {
	if (!props.maskClosable) return;
	emit('cancel');
};



	

return (_ctx, _cache) => {
  const _component_v_uni_view = index$g;
  const _component_v_uni_button = index$x;

  return (openBlock(), createBlock(_component_v_uni_view, {
    onTouchmove: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop","prevent"]))
  }, {
    default: withCtx(() => [
      createVNode(_component_v_uni_view, {
        class: normalizeClass(["modal-box", [(__props.fadein || props.show)?'modal-normal':'modal-scale',props.show?'modal-show':'']]),
        style: normalizeStyle({width:props.width,padding:props.padding,borderRadius:props.radius})
      }, {
        default: withCtx(() => [
          (props.custom)
            ? (openBlock(), createBlock(_component_v_uni_view, { key: 0 }, {
                default: withCtx(() => [
                  renderSlot(_ctx.$slots, "default", {}, undefined, true)
                ]),
                _: 3
              }))
            : (openBlock(), createBlock(_component_v_uni_view, { key: 1 }, {
                default: withCtx(() => [
                  (props.title)
                    ? (openBlock(), createBlock(_component_v_uni_view, {
                        key: 0,
                        class: "modal-title"
                      }, {
                        default: withCtx(() => [
                          createTextVNode(toDisplayString(props.title), 1)
                        ]),
                        _: 1
                      }))
                    : createCommentVNode("", true),
                  createVNode(_component_v_uni_view, {
                    class: normalizeClass(["modal-content", [props.title?'':'mtop']]),
                    style: normalizeStyle({color:props.color,fontSize:props.size+'rpx'})
                  }, {
                    default: withCtx(() => [
                      renderSlot(_ctx.$slots, "default", {}, undefined, true)
                    ]),
                    _: 3
                  }, 8, ["class", "style"]),
                  createVNode(_component_v_uni_view, {
                    class: normalizeClass(["modalBtn-box", [props.button.length!=2?'flex-column':'']])
                  }, {
                    default: withCtx(() => [
                      (openBlock(true), createElementBlock(Fragment, null, renderList(props.button, (item, index) => {
                        return (openBlock(), createBlock(_component_v_uni_button, {
                          key: index,
                          class: normalizeClass(["modal-btn", [
										''+(item.type || 'primary')+(item.plain?'-outline':''),
										props.button.length!=2?'btn-width':'',
										props.button.length>2?'mbtm':'',
										props.shape=='circle'?'circle-btn':'',
										'btn-' + (item.size || 'default'),										
									]]),
                          "hover-class": ''+(item.plain?'outline':(item.type || 'primary'))+'-hover',
                          "data-index": index,
                          onClick: handleClick
                        }, {
                          default: withCtx(() => [
                            createTextVNode(toDisplayString(item.text || "确定"), 1)
                          ]),
                          _: 2
                        }, 1032, ["class", "hover-class", "data-index"]))
                      }), 128))
                    ]),
                    _: 1
                  }, 8, ["class"])
                ]),
                _: 3
              }))
        ]),
        _: 3
      }, 8, ["style", "class"]),
      createVNode(_component_v_uni_view, {
        class: normalizeClass(["modal-mask", [props.show?'mask-show':'']]),
        onClick: handleClickCancel
      }, null, 8, ["class"])
    ]),
    _: 3
  }))
}
}

};
const __easycom_8 = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-96aa7135"]]);

export { __easycom_8 as _ };
